Update plugin tests to nightly
authorAlex Crichton <alex@alexcrichton.com>
Mon, 30 Nov 2015 19:21:04 +0000 (11:21 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 30 Nov 2015 23:01:46 +0000 (15:01 -0800)
Makefile.in
appveyor.yml
src/etc/dl-snapshot.py
src/etc/download.py
src/etc/install-deps.py
src/rustversion.txt
tests/test_cargo_compile_plugins.rs
tests/test_cargo_cross_compile.rs

index bd7f915e63fa04605deff4dd83fea04f5bbee031..8661589a392a7355eb2d0e62971d32a13edbb25f 100644 (file)
@@ -75,7 +75,7 @@ $(foreach target,$(CFG_TARGET),$(eval $(call DIST_TARGET,$(target))))
 ifdef CFG_LOCAL_CARGO
 CARGO := $(CFG_LOCAL_CARGO)
 else
-CARGO := $(TARGET_ROOT)/snapshot/cargo/bin/cargo$(X)
+CARGO := $(TARGET_ROOT)/snapshot/bin/cargo$(X)
 endif
 
 all: $(foreach target,$(CFG_TARGET),cargo-$(target))
@@ -92,7 +92,7 @@ test-unit-$(1): $$(CARGO)
 endef
 $(foreach target,$(CFG_TARGET),$(eval $(call CARGO_TARGET,$(target))))
 
-$(TARGET_ROOT)/snapshot/cargo/bin/cargo$(X): src/snapshots.txt
+$(TARGET_ROOT)/snapshot/bin/cargo$(X): src/snapshots.txt
        $(CFG_PYTHON) src/etc/dl-snapshot.py $(CFG_BUILD)
        touch $@
 
index 18fc5f2fd5a9f72e676afc0c7bcc9af1d72f71a3..39c11e1f7c82f0375c5a1ee3eb6e936e8a694fde 100644 (file)
@@ -16,7 +16,7 @@ install:
   - python src/etc/dl-snapshot.py %TARGET%
   - call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %ARCH%
   - SET PATH=%PATH%;%cd%/rustc/bin
-  - SET PATH=%PATH%;%cd%/target/snapshot/cargo/bin
+  - SET PATH=%PATH%;%cd%/target/snapshot/bin
   - if defined NEEDS_LIBGCC set PATH=%PATH%;C:\MinGW\bin
   - rustc -V
   - cargo -V
index b279f536a89aeb6938693ee7c03790091bf06c84..c43f47fd6d613431a5b77adcef1ed66e30d9a25e 100644 (file)
@@ -93,4 +93,4 @@ if not exists:
     if h != hash:
         raise Exception("failed to verify the checksum of the snapshot")
 
-download.unpack(dl_path, dst)
+download.unpack(dl_path, dst, strip=2)
index 8072737827bb6332bfee5890dba39ea8dd0c0eeb..d61e9fa8f34bae6fbf1234e08ad96275b27fc7df 100644 (file)
@@ -16,22 +16,29 @@ def get(url, path, quiet=False):
         run(["curl", "-o", path, url], quiet=quiet)
 
 
-def unpack(tarball, dst, quiet=False):
+def unpack(tarball, dst, quiet=False, strip=0):
     if quiet:
         print("extracting " + tarball)
-    fname = os.path.basename(tarball).replace(".tar.gz", "")
     with contextlib.closing(tarfile.open(tarball)) as tar:
-        for p in tar.getnames():
-            name = p.replace(fname + "/", "", 1)
-            fp = os.path.join(dst, name)
-            if not quiet:
-                print("extracting " + p)
-            tar.extract(p, dst)
-            tp = os.path.join(dst, p)
-            if os.path.isdir(tp) and os.path.exists(fp):
+        for p in tar.getmembers():
+            if p.isdir():
+                continue
+            path = []
+            p2 = p.name
+            while p2 != "":
+                a, b = os.path.split(p2)
+                path.insert(0, b)
+                p2 = a
+            if len(path) <= strip:
                 continue
-            shutil.move(tp, fp)
-    shutil.rmtree(os.path.join(dst, fname))
+            fp = os.path.join(dst, *path[strip:])
+            if not quiet:
+                print("extracting " + p.name)
+            contents = tar.extractfile(p)
+            if not os.path.exists(os.path.dirname(fp)):
+                os.makedirs(os.path.dirname(fp))
+            open(fp, 'wb').write(contents.read())
+            os.chmod(fp, p.mode)
 
 
 def run(args, quiet=False):
index 1d73f69cae9a3e0995ffd9d1991400a8de5b6cab..28a4fb7b1eda4882e6e79bcd7651a9f0ee64bba6 100644 (file)
@@ -15,7 +15,6 @@ else:
     extra_bits = 'i686'
 
 extra = None
-libdir = 'lib'
 
 # Figure out our target triple
 if sys.platform == 'linux' or sys.platform == 'linux2':
@@ -25,7 +24,6 @@ elif sys.platform == 'darwin':
     host = host_bits + '-apple-darwin'
     extra = extra_bits + '-apple-darwin'
 elif sys.platform == 'win32':
-    libdir = 'bin'
     if os.environ.get('MSVC') == '1':
         host = host_bits + '-pc-windows-msvc'
         extra = extra_bits + '-pc-windows-msvc'
@@ -42,33 +40,26 @@ def install_via_tarballs():
     if os.path.isdir("rustc-install"):
         shutil.rmtree("rustc-install")
 
+    # Download the compiler
     host_fname = 'rustc-nightly-' + host + '.tar.gz'
     download.get(url + '/' + host_fname, host_fname)
-    download.unpack(host_fname, "rustc-install", quiet=True)
+    download.unpack(host_fname, "rustc-install", quiet=True, strip=2)
     os.remove(host_fname)
 
+    # Download all target libraries needed
+    fetch_std(host)
     if extra is not None:
-        extra_fname = 'rustc-nightly-' + extra + '.tar.gz'
-        print("adding target libs for " + extra)
-        download.get(url + '/' + extra_fname, extra_fname)
-        folder = extra_fname.replace(".tar.gz", "")
-        with contextlib.closing(tarfile.open(extra_fname)) as tar:
-            for p in tar.getnames():
-                if not "rustc/" + libdir + "/rustlib/" + extra in p:
-                    continue
-                name = p.replace(folder + "/", "", 1)
-                dst = "rustc-install/" + name
-                tar.extract(p, "rustc-install")
-                tp = os.path.join("rustc-install", p)
-                if os.path.isdir(tp) and os.path.exists(dst):
-                    continue
-                shutil.move(tp, dst)
-        shutil.rmtree("rustc-install/" + folder)
-        os.remove(extra_fname)
+        fetch_std(extra)
 
     if os.path.isdir("rustc"):
         shutil.rmtree("rustc")
-    os.rename("rustc-install/rustc", "rustc")
-    shutil.rmtree("rustc-install")
+    os.rename("rustc-install", "rustc")
+
+def fetch_std(target):
+    fname = 'rust-std-nightly-' + target + '.tar.gz'
+    print("adding target libs for " + target)
+    download.get(url + '/' + fname, fname)
+    download.unpack(fname, "rustc-install", quiet=True, strip=2)
+    os.remove(fname)
 
 install_via_tarballs()
index 7063ccdcabaf12d32b503ff4c8933f4a739bb986..5fdf51cb8f8aaba8bd6cd02859f37b33d915e195 100644 (file)
@@ -1 +1 @@
-2015-10-17
+2015-11-30
index 670f4a63badca9849e1eaf4ec82e8d2f91161cd9..dca74a6df871dffde35c1cd717b95a92212b8163 100644 (file)
@@ -54,10 +54,10 @@ test!(plugin_to_the_max {
         .file("src/lib.rs", r#"
             #![feature(plugin_registrar, rustc_private)]
 
-            extern crate rustc;
+            extern crate rustc_plugin;
             extern crate baz;
 
-            use rustc::plugin::Registry;
+            use rustc_plugin::Registry;
 
             #[plugin_registrar]
             pub fn foo(_reg: &mut Registry) {
@@ -154,9 +154,9 @@ test!(plugin_with_dynamic_native_dependency {
         "#)
         .file("bar/src/lib.rs", &format!(r#"
             #![feature(plugin_registrar, rustc_private)]
-            extern crate rustc;
+            extern crate rustc_plugin;
 
-            use rustc::plugin::Registry;
+            use rustc_plugin::Registry;
 
             #[link(name = "{}")]
             extern {{ fn foo(); }}
index 3d4174afb435ee9179ffa302170f75f129017584..06686bf9087ede20908ad6181af6641550d569c7 100644 (file)
@@ -153,10 +153,10 @@ test!(plugin_deps {
         .file("src/lib.rs", r#"
             #![feature(plugin_registrar, quote, rustc_private)]
 
-            extern crate rustc;
+            extern crate rustc_plugin;
             extern crate syntax;
 
-            use rustc::plugin::Registry;
+            use rustc_plugin::Registry;
             use syntax::ast::TokenTree;
             use syntax::codemap::Span;
             use syntax::ext::base::{ExtCtxt, MacEager, MacResult};
@@ -233,11 +233,11 @@ test!(plugin_to_the_max {
         .file("src/lib.rs", r#"
             #![feature(plugin_registrar, quote, rustc_private)]
 
-            extern crate rustc;
+            extern crate rustc_plugin;
             extern crate syntax;
             extern crate baz;
 
-            use rustc::plugin::Registry;
+            use rustc_plugin::Registry;
             use syntax::ast::TokenTree;
             use syntax::codemap::Span;
             use syntax::ext::base::{ExtCtxt, MacEager, MacResult};
@@ -352,10 +352,10 @@ test!(plugin_with_extra_dylib_dep {
         .file("src/lib.rs", r#"
             #![feature(plugin_registrar, rustc_private)]
 
-            extern crate rustc;
+            extern crate rustc_plugin;
             extern crate baz;
 
-            use rustc::plugin::Registry;
+            use rustc_plugin::Registry;
 
             #[plugin_registrar]
             pub fn foo(reg: &mut Registry) {